<template>
  <div class="department" id="department">
    <!-- 右侧 -->
    <div class="department_right">
      <div class="app-container-btn">
        <el-button
          type="primary"
          @click="yj_saveForm(0)"
          v-if="SZJP == 0 && btnShow"
        >
          保存配方
        </el-button>
        <el-button
          type="primary"
          @click="yj_saveForm(1)"
          v-if="SZJP == 1 && btnShow"
        >
          保存级配
        </el-button>
        <el-button @click="goBack">返回</el-button>
      </div>
      <!-- 表格 -->
      <div class="text_table TensionRealTime">
        <div
          v-if="SZJP == 0"
          class="dialogBody common table_detail tensionCollapse"
          id="mixProportionBox"
          style="overflow: hidden; height: calc(100% - 50px);"
        >
          <el-collapse
            style="height: 100%"
            v-model="activeNames"
            @change="changeCollapse"
          >
            <el-collapse-item name="0" >
              <template slot="title">
                <div class="app-container-area-title">
                  <span class="app-container-area-title-divider"></span>
                  <span>基本信息</span>
                </div>
              </template>
              <!-- mixproportionForm -->
              <div class="OilStoneRate">
                <publicForm
                  :messAgeNum="1"
                  ref="publicForm"
                  lableWidth="75px"
                  :formObj="formObj"
                  :formData="formData"
                  :timestamp="formData.fStatus"
                  :fileList="fSourcefileList"
                  @delteFile="delteFile"
                  @selectChange="selectChange"
                >
                </publicForm>
              </div>
            </el-collapse-item>
            <el-collapse-item name="1" >
              <template slot="title">
                <div class="app-container-area-title">
                  <span class="app-container-area-title-divider"></span>
                  <span>油石比</span>
                </div>
              </template>
              <div class="OilStoneRate">
                <publicForm
                  :messAgeNum="1"
                  ref="publicForm0"
                  lableWidth="75px"
                  :formObj="OilStoneRate"
                  :formData="formData"
                >
                </publicForm>
              </div>
            </el-collapse-item>
            <el-collapse-item name="2" >
              <template slot="title">
                <div class="app-container-area-title">
                  <span class="app-container-area-title-divider"></span>
                  <span>温度</span>
                </div>
              </template>
              <div class="OilStoneRate">
                <publicForm
                  :messAgeNum="1"
                  ref="publicForm1"
                  lableWidth="75px"
                  :formObj="temperature"
                  :formData="formData"
                >
                </publicForm>
              </div>
            </el-collapse-item>
            <el-collapse-item name="3" >
              <template slot="title">
                <div class="app-container-area-title">
                  <span class="app-container-area-title-divider"></span>
                  <span>时长</span>
                </div>
              </template>
              <div class="OilStoneRate">
                <publicForm
                  :messAgeNum="1"
                  ref="publicForm1"
                  lableWidth="75px"
                  :formObj="mixingTime"
                  :formData="formData"
                >
                </publicForm>
              </div>
            </el-collapse-item>
            <el-collapse-item name="4" >
              <template slot="title">
                <div class="app-container-area-title">
                  <span class="app-container-area-title-divider"></span>
                  <span>配合比</span>
                </div>
              </template>
              <div class="OilStoneRate table_detail">
                <publicForm
                  :messAgeNum="1"
                  ref="publicForm2"
                  lableWidth="85px"
                  :formObj="mixProportion"
                  :formData="formData"
                >
                </publicForm>
              </div>
            </el-collapse-item>
          </el-collapse>
          <div style="height: 50px"></div>
        </div>

        <div
          v-if="SZJP == 1"
          class="dialogBody common table_detail tensionCollapse"
          id="mixProportionBox"
          style="overflow: hidden; height: 100%"
        >
          <template slot="title">
            <div class="app-container-area-title">
              <span class="app-container-area-title-divider"></span>
              <span>筛分实验数据</span>
            </div>
          </template>
          <div style="width: 100%; height: 100%" class="fillableBox">
            <div class="JpList">
              <div
                :class="{
                  JpSieveListBox,
                  JpSieveListBox2: iSJpSieveListBox == i,
                }"
                v-for="(v, i) in JpSieveList"
                :key="i"
                @click="JpSieveListFun(v, i)"
              >
                启用时间：{{ v.fCreatedates }}
              </div>
            </div>
            <div class="JpDetails">
              <tableData
                style="height: 100%"
                :config="table_sieve"
                :currentRow="false"
                :dataList="sieveList"
                :loading="listsieveLoading"
                placeholderText=""
                @inputValue="inputValue"
                statusType="1"
              />
            </div>
          </div>
        </div>
      </div>
      <messageBox
        :showMsgBox="showMsgBox"
        :msgTip="msgTip"
        :msgType="msgType"
        @confirmMsg="confirmMsg"
      ></messageBox>
    </div>
  </div>
</template>
<script>
import TableData from "@/components/public/el-tables"; //主页面列表
import Pagination from "@/components/public/el-pagination"; //主页面分页
import publicForm from "@/components/public/el-form.vue"; //弹框form
import formJs from "./regexDetail.js"; //新增弹框配置项
// import commonPage from '@/components/pitchManage/dyMonitorManage/real_timeDataPage';//主页面列表
import messageBox from "@/components/public/messageBox"; //主页面分页
import actions from "@/actions";
import {
  // getAsphaltRecipeLists, //沥青拌合站 基础设置 查询-配方管理列表页
  saveAsphaltRecipe, //沥青拌合站 基础设置 配方管理-配方保存接口
  delAsphaltRecipe, // 沥青拌合站 基础设置  删除-配方管理
  getAsphaltRecipeDetail, // 沥青拌合站 基础设置  查询-配方管理详情页
  getDictionaryTree, //字典项
  getAsphaltRecipeListByCompanyId, // 查询-沥青混合料类型下拉框
  getAsphaltRecipeSieveList, //级配列表
  saveAsphaltRecipeSieve, //级配保存
  getAsphaltRecipeSieveDetail, //级配详情
} from "@/api/request.js";

export default {
  name: "mixProportionDetail",
  data() {
    return {
      name: "mixProportionDetail", //按钮配置页面代号
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
      },
      showMsgBox: false,
      msgTip: "请先选中数据行！",
      msgType: 1,
      timeDuring: [], //主页面日期筛选绑定值
      rowInfo: null, //当前行信息
      projectsObj: [], //项目名
      tendersObj: [],
      falgId: null,
      editLoading: false,
      iSJpSieveListBox: 0,
      table_config: formJs.table_config, // 列表配置项
      table_sieve: formJs.sieveAperture, //级配设置
      activeNames: ["0", "1", "2", "3", "4"],
      navigatepageNums: null, //是否显示分页
      queryCriteriaData: {}, //分页
      value2: "", //主页面日期筛选绑定值
      tableData: [], //表格列表数据列表
      // sieveApertureData: formJs.sieveApertureData,//级配设置
      highlightBd: true, //左侧机构树停留背景色
      treelength: false, //左侧树显示隐藏
      showName: "未选择公司",
      fId: null, //点击当前列表数据fId
      listLoading: false, //列表数据加载loading
      listsieveLoading: false, //级配设置
      sgcDataList: formJs.sgcDataList, //施工层位
      liqhDataList: [], //沥青混合料类型
      formData: {
        userId: "", // 当前登录用户id
        userName: "", // 当前登录用户名
        fCompanyid: "", // 当前标段id
        fCompanyname: "", // 当前标段公司name
        fId: "", // 配方fid
        fRecipenumber: "", // 配方编号
        fRecipename: "", // 配方名称
        fMixturetype: "", // 混合料类型
        fMixduration: "", //拌合时长
        fPitchnum: "", // 沥青标号
        fStandard: "", // 执行标准
        fSurfacecourse: "", // 施工部位
        fStartdates: "", // 启用时间
        fRecipedescription: "", // 描述
        fStatus: "", // 配方附件
        fAsphaltaggregateratiogoalvalue: "", // 油石比目标值
        fAsphaltaggregateratioupper: "", // 油石比上限
        fAsphaltaggregateratiolower: "", // 油石比下限
        fTemperatureupper: "", // 温度上限
        fTemperaturelower: "", // 温度下限
        fAggregate1value: "", // 骨料1目标值
        fAggregate2value: "", // 骨料2目标值
        fAggregate3value: "", // 骨料3目标值
        fAggregate4value: "", // 骨料4目标值
        fAggregate5value: "", // 骨料5目标值
        fAggregate6value: "", // 骨料6目标值
        fPowder1value: "", // 粉料1目标值
        fPowder2value: "", // 粉料2目标值
        fPowder3value: "", // 粉料总目标值
        fCementvalue: "",
        sieveList: [],
        recordfiles: [], // 删除文件id集合
      },
      sieveList: [], //级配列表数据
      formObj: formJs.formObj,
      OilStoneRate: formJs.OilStoneRate,
      temperature: formJs.temperature,
      mixingTime: formJs.mixingTime,
      mixProportion: formJs.mixProportion,

      fSourcefileList: [],

      userInfo: {}, //登录用户

      dialogTitle: "查看",
      commonData: {},
      btnShow: true, //保存按钮是否显示
      publicTable: true, //新增配方表
      rowInfo: null,
      btnPowerShow: true,

      asphaltNoList: null, //字典温度查询
      SZJP: "", //控制显示弹框内容
      JpSieveList: [], //级配时间列表
    };
  },
  components: {
    messageBox,
    TableData, //主页面列表

    Pagination, //分页
    publicForm,
    // commonPage
  },
  mounted() {
    var that = this;
    actions.onGlobalStateChange((state, prev) => {
      this.userInfo = prev.currentUser;
      console.log("userInfo", this.userInfo);
      this.token = prev.token;
      that.yj_editForm(
        JSON.parse(this.$route.query.data),
        this.$route.query.status
      );
      var data = prev.currentUser.projects;

      this.projectsObj = [
        {
          fItemName: "所有项目",
          fItemValue: "",
        },
      ];
      data.map((item) => {
        this.projectsObj.push({
          fItemName: item.projectName,
          fItemValue: item.projectId,
        });
      });
    }, true);
    this.formObj[2].options = [];
    this.formObj[4].options = [];
    this.dictionaryItem("mixType", 0);
    this.dictionaryItem("asphaltNo", 1);
  },
  methods: {
    goBack() {
      this.$router.back();
    },
    confirmMsg() {
      this.showMsgBox = false;
    },

    changeCollapse(e) {
      console.log(this.activeNames, e);
      return e;
    },
    // 点击当前行
    rowChange(val) {
      this.rowInfo = val;
    },

    // 新增编辑查看弹框
    yj_editForm(data, status) {
      // console.log(1111, data, status);
      this.table_sieve.thead.map((item, index) => {
        if (index != 0) {
          item.edit = true;
        }
      });
      if (status == 0) {
        //新增
        this.SZJP = "0";
        this.dialogTitle = "新增配方";
        this.formData = {
          userId: this.userInfo.id, // 当前登录用户id
          userName: this.userInfo.userName, // 当前登录用户名
          fCompanyid: JSON.parse(this.$route.query.Company).fCompanyid, // 当前登录用户公司id
          fCompanyname: JSON.parse(this.$route.query.Company).fCompanyname, // 当前登录用户公司name
          fId: "", // 配方fid
          fRecipenumber: "", // 配方编号
          fRecipename: "", // 配方名称
          fMixturetype: "", // 混合料类型
          fMixduration: "", //拌合时长
          fPitchnum: "", // 沥青标号
          fStandard: "", // 执行标准
          fSurfacecourse: "", // 施工部位
          fStartdates: this.common.getDay(0) + " " + this.common.getDays(), // 启用时间
          fRecipedescription: "", // 描述
          fStatus: "", // 配方附件
          fAsphaltaggregateratiogoalvalue: "", // 油石比目标值
          fAsphaltaggregateratioupper: "", // 油石比上限
          fAsphaltaggregateratiolower: "", // 油石比下限
          fTemperatureupper: "", // 温度上限
          fTemperaturelower: "", // 温度下限
          fAggregate1value: "", // 骨料1目标值
          fAggregate2value: "", // 骨料2目标值
          fAggregate3value: "", // 骨料3目标值
          fAggregate4value: "", // 骨料4目标值
          fAggregate5value: "", // 骨料5目标值
          fAggregate6value: "", // 骨料6目标值
          fPowder1value: "", // 粉料1目标值
          fPowder2value: "", // 粉料2目标值
          fPowder3value: "", // 粉料总目标值
          fCementvalue: "",
          sieveList: [],
          recordfiles: [], // 删除文件id集合
        };
        // this.formData = this.$options.data.call(this).formData
        this.fSourcefileList = [];
        getAsphaltRecipeDetail({ fId: "" }).then((res) => {
          if (res.errcode == 0) {
            // this.formData = res.data.asphaltRecipe;
            console.log("this.formData", this.formData);
            this.formData.fStatus = res.data.asphaltRecipe.fStatus;
            this.formData.fMixturetype = res.data.asphaltRecipe.fMixturetype;
          } else {
            this.msgTip = "获取详情接口报错:" + res.msg;
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
          }
        });

        this.formObj.map((item) => {
          //基本信息
          item.disabled = false;
          item.uploadSelect = true; //上传附件按钮是否显示
          // item.rules[0].required = true;
        });
        this.OilStoneRate.map((item) => {
          //油石比
          item.disabled = false;
          // item.rules[0].required = true;
        });
        this.temperature.map((item) => {
          //温度
          item.disabled = false;
          // item.rules[0].required = true;
        });
        this.mixProportion.map((item) => {
          //配合比
          item.disabled = false;
          // item.rules[0].required = true;
        });

        this.mixingTime.map((item) => {
          //拌合时长
          item.disabled = false;
          // item.rules[0].required = true;
        });

        // this.table_sieve.thead.map((item, index) => {
        //   if (index != 0) {
        //     item.edit = true;
        //   }
        // });
        this.btnShow = true; //新增时按钮显示
      } else if (status == 1) {
        //编辑
        this.dialogTitle = "编辑配方";
        this.SZJP = "0";
        this.btnShow = true; //编辑时按钮显示

        this.formObj.map((item) => {
          item.disabled = false;
          item.uploadSelect = true; //上传附件按钮是否显示
          // item.rules[0].required = true
        });
        this.OilStoneRate.map((item) => {
          //油石比
          item.disabled = false;
          // item.rules[0].required = true
        });
        this.temperature.map((item) => {
          //温度
          item.disabled = false;
          // item.rules[0].required = true
        });
        this.mixProportion.map((item) => {
          //配合比
          item.disabled = false;
        });
        this.mixingTime.map((item) => {
          //拌合时长
          item.disabled = false;
          // item.rules[0].required = true;
        });
        // this.table_sieve.thead.map((item, index) => {
        //   if (index != 0) {
        //     item.edit = true;
        //   }
        // });
        this.yj_viewForm(data);
      } else if (status == 2) {
        this.SZJP = "0";
        this.dialogTitle = "查看配方";
        this.btnShow = false; //编辑时按钮显示

        this.formObj.map((item) => {
          item.disabled = true;
          item.uploadSelect = false; //上传附件按钮是否显示
          // item.rules[0].required = false;
        });
        this.OilStoneRate.map((item) => {
          //油石比
          item.disabled = true;
          // item.rules[0].required = false;
        });
        this.temperature.map((item) => {
          //温度
          item.disabled = true;
          // item.rules[0].required = false;
        });
        this.mixProportion.map((item) => {
          //配合比
          item.disabled = true;
          // item.rules[0].required = false;
        });
        this.mixingTime.map((item) => {
          //拌合时长
          item.disabled = true;
          // item.rules[0].required = false;
        });
        this.table_sieve.thead.map((item, index) => {
          if (index != 0) {
            item.edit = false;
          }
        });
        this.yj_viewForm(data);
      } else if (status == 3) {
        //编辑
        this.dialogTitle = "设置级配";
        this.SZJP = "1";
        this.btnShow = true; //编辑时按钮显示
        // this.activeNames = ["0", "1", "2", "3", "4", "5"];
        this.getJpList(data);
      }
    },
    // 级配列表
    getJpList(data) {
      var row = data;
      if (row != null) {
        var id = row.fId;
        this.fId = row.fId;
        getAsphaltRecipeSieveList({ fId: id })
          .then((res) => {
            if (res.errcode == 0) {
              this.JpSieveList = res.data.sieveList;
              console.log("级配列表JpSieveList", this.JpSieveList);
              this.getJpDetails(
                res.data.sieveList[0].fCreatedates,
                res.data.sieveList[0].fParentid
              );
            } else {
              this.msgTip = "级配列表接口报错:" + res.msg;
              this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
              this.showMsgBox = true;
            }
          })
          .catch(() => {
            console.log("级配列表接口报错");
          });
      } else {
        this.msgTip = "请先选择需要查看的数据";
        this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
        this.showMsgBox = true;
      }
    },
    JpSieveListFun(data, i) {
      this.iSJpSieveListBox = i;
      this.getJpDetails(data.fCreatedates, data.fParentid);
      // return i
    },
    // 级配详情
    getJpDetails(time, id) {
      getAsphaltRecipeSieveDetail({
        fCreatedates: time, // 级配启用时间
        fParentid: id, // 配方id
      })
        .then((res) => {
          if (res.errcode == 0) {
            console.log("级配详情", res);
            var datas = res.data.asphaltRecipeSieveDetail;
            datas.map((item) => {
              if (
                item.fSieveupper != null &&
                item.fSieveupper != "" &&
                item.fSievelower != null &&
                item.fSievelower != ""
              ) {
                item.fSievemiddle =
                  (item.fSieveupper - 0 + (item.fSievelower - 0)) / 2;
              } else {
                item.fSievemiddle = "";
              }
            });
            this.sieveList = datas;
          } else {
            this.msgTip = "级配详情接口报错:" + res.msg;
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
          }
        })
        .catch(() => {
          console.log("级配详情接口报错");
        });
    },
    // // 获取列表数据
    // yj_searchForm(data) {
    //   this.listLoading = true;
    //   window.sessionStorage.setItem(
    //     "GxEmbedded_pitchManage_getLists",
    //     JSON.stringify(data)
    //   );
    //   this.tableData = [];
    //   var id;
    //   if (data.fCompanyid != "") {
    //     id = data.fCompanyid;
    //   } else {
    //     id = data.fprojectid;
    //   }
    //   var sc = {
    //     fCompanyid: id, // 施工标段id
    //     startDates: data.startDates, // 开始时间
    //     endDates: data.endDates, // 截至时间
    //     stationId: "", //拌合站
    //     machineId: "", //拌合机
    //     fConstructionhorizon: data.fConstructionhorizon, // 施工层位
    //     fMixturetype: data.fMixturetype, //  沥青混合料类型
    //     warningLevel: "", // 预警等级
    //     fCloseoperation: "", //闭合状态
    //     page: data.page, // 当前页码
    //     pageSize: data.pageSize, // 每页显示条数
    //   };
    //   getAsphaltRecipeLists(sc)
    //     .then((res) => {
    //       if (res.errcode == 0) {
    //         var that = this;
    //         that.listLoading = false;
    //         that.tableData = res.data.pageInfo.list;
    //         this.queryCriteriaData = res.data.pageInfo; //分页信息
    //         this.navigatepageNums =
    //           this.queryCriteriaData.navigatepageNums.length;
    //       } else {
    //         this.$message.error(res.msg);
    //         return false;
    //       }
    //     })
    //     .catch((error) => {
    //       console.log(error);
    //     });
    // },
    yj_viewForm(data) {
      var row = data;
      if (row != null) {
        var id = row.fId;
        this.fId = row.fId;
        getAsphaltRecipeDetail({ fId: id }).then((res) => {
          if (res.errcode == 0) {
            this.formData = res.data.asphaltRecipe;
            console.log("编辑this.formData", this.formData);
            this.formData.recordfiles = []; // 删除文件id集合
            this.fSourcefileList = res.data.fileList; // 附件
          } else {
            this.msgTip = "获取详情接口报错:" + res.msg;
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
          }
        });
      } else {
        this.msgTip = "请先选择需要查看的数据";
        this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
        this.showMsgBox = true;
      }
    },
    yj_saveForm(num) {
      if (num == 0) {
        if (this.publicTable == true) {
          if (
            this.$refs.publicForm.submitForm() &&
            this.$refs.publicForm0.submitForm() &&
            this.$refs.publicForm1.submitForm() &&
            this.$refs.publicForm2.submitForm()
          ) {
            // this.formData.fCompanyid = this.userInfo.companyId;
            // this.formData.fCompanyname = this.userInfo.companyName;
            // this.formData.userId = this.userInfo.id; // 当前登录用户id
            // this.formData.userName = this.userInfo.userName; // 当前登录用户名
            saveAsphaltRecipe(this.formData).then((res) => {
              if (res.errcode == 0) {
                this.$router.push({
                  path: "/pitchManage/mixProportion",
                });
                // this.yj_searchForm(this.getList);
                // this.$message.success("新增成功");
              } else {
                this.msgTip = "新增失败:" + res.msg;
                this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
                this.showMsgBox = true;
              }
            });
          } else {
            this.msgTip = "请把信息填写完整！";
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
          }
        } else {
          console.log(123);
        }
      } else if (num == 1) {
        var data = {
          userId: this.userInfo.id, // 当前登录用户id
          userName: this.userInfo.userName, // 当前登录用户名
          fCompanyid: JSON.parse(this.$route.query.data).fCompanyid, // 当前登录用户公司id
          fCompanyname: JSON.parse(this.$route.query.data).fCompanyname,
          fId: this.fId, // 配方fid
          sieveList: this.sieveList,
        };
        saveAsphaltRecipeSieve(data).then((res) => {
          if (res.errcode == 0) {
            this.$router.push({
              path: "/pitchManage/mixProportion",
            });
            // this.$message.success("新增级配成功");
          } else {
            this.msgTip = "新增级配失败:" + res.msg;
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
          }
        });
      }
    },

    getAsphaltRecipeListByCompanyId(id) {
      var data = {
        fCompanyid: id,
      };
      this.liqhDataList = [];
      getAsphaltRecipeListByCompanyId(data)
        .then((res) => {
          if (res.errcode == 0) {
            var arr = res.data.asphaltRecipeList;
            this.liqhDataList = [
              {
                fItemName: "所有沥青混合料类型",
                fItemValue: "",
              },
            ];
            arr.map((item) => {
              this.liqhDataList.push({
                fItemName: item.fMixturetype,
                fItemValue: item.fMixturetype,
              });
            });
          } else {
            this.msgTip = res.msg;
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
            // this.$message.error(res.msg);
            // return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },

    selectChange(value, index, prop) {
      // 下拉框改变
      console.log("index", index);
      let itemvalue = null;
      if (prop == "fPitchnum") {
        for (let index = 0; index < this.asphaltNoList.length; index++) {
          const element = this.asphaltNoList[index];
          if (value == element.fItemname) {
            itemvalue = element.fItemvalue.split("-");
          }
        }

        this.formData.fTemperatureupper = itemvalue[1];
        this.formData.fTemperaturelower = itemvalue[0];
      }
    },
    // 获取字典项
    dictionaryItem(id, num) {
      getDictionaryTree({ fItemcode: id })
        .then((res) => {
          if (res.errcode == 0) {
            if (num == 1) {
              this.asphaltNoList = res.data.baseDataitemdetailList;
            }

            res.data.baseDataitemdetailList.map((item) => {
              if (num == 0) {
                this.formObj[2].options.push({
                  value: item.fItemname,
                  label: item.fItemname,
                });
              } else if (num == 1) {
                this.formObj[4].options.push({
                  value: item.fItemname,
                  label: item.fItemname,
                });
              }
            });
          } else {
            this.msgTip = "获取字典项失败:" + res.msg;
            this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
            this.showMsgBox = true;
          }
        })
        .catch(() => {
          console.log("获取字典项失败");
        });
    },

    inputValue(val, table, label) {
      if (label == "fSieveupper" || label == "fSievelower") {
        table.map((item) => {
          if (
            item.fSieveupper != null &&
            item.fSieveupper != "" &&
            item.fSievelower != null &&
            item.fSievelower != ""
          ) {
            item.fSievemiddle =
              (item.fSieveupper - 0 + (item.fSievelower - 0)) / 2;
          } else {
            item.fSievemiddle = "";
          }
        });
      }
      this.sieveList = table;
    },

    rowDelete() {
      if (this.rowInfo != null) {
        this.listLoading = true;
        this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            delAsphaltRecipe({ fId: this.rowInfo.fId }).then((res) => {
              if (res.errcode == 0) {
                this.listLoading = false;
                this.yj_searchForm(this.getList);
                // this.$message.success("删除成功");
              } else {
                this.msgTip = "删除失败:" + res.msg;
                this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
                this.showMsgBox = true;
              }
            });
          })
          .catch(() => {
            this.listLoading = false;
            // this.$message("取消删除");
          });
      } else {
        this.msgTip = "请先选择需要删除的数据";
        this.msgType = 1; // 0 带功能确定  1 无功能确定  2 带功能确定、取消
        this.showMsgBox = true;
        // return this.$message.error("请先选择需要删除的数据");
      }
    },
    delteFile(file) {
      // console.log(file, this.fSourcefileList);
      for (let index = 0; index < this.fSourcefileList.length; index++) {
        if (file.uid == this.fSourcefileList[index].uid) {
          if (this.fSourcefileList[index].atta == undefined) {
            this.formData.recordfiles.push({
              fId: this.fSourcefileList[index].fId,
            });
          } else {
            this.formData.recordfiles.push({
              fId: this.fSourcefileList[index].atta.fId,
            });
          }
          this.fSourcefileList.splice(index, 1);
        }
      }
    },

    // 获取拌合机
    getbhjDataMethods(data) {
      getMachineListByStationId({ stationId: data })
        .then((res) => {
          if (res.errcode == 0) {
            var arr = res.data.stationmachineList;

            this.bhjDataList = [
              {
                fItemName: "所有拌和机",
                fItemValue: "",
              },
            ];
            arr.map((item) => {
              this.bhjDataList.push({
                fItemName: item.fMachinename,
                fItemValue: item.fMachineid,
              });
            });
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>

<style scoped lang="less">
.printTables {
  background: #fff;
  display: flex;
  justify-content: end;
  padding: 5px;
  margin-top: 10px;
}

.jpbox {
  height: 100%;
}

.dialogBody {
  padding: 3px 20px;
  height: 80%;
  // overflow-y: auto;
  // display: flex;
  // flex-direction: column;
}

.baseTitle {
  /* border: 1px solid #0c204d; */
  border-bottom: 1px solid #0c204d;
  width: 100%;
  height: 30px;
  line-height: 30px;
  position: relative;
  padding-left: 15px;
}

.baseTitle::after {
  display: block;
  content: "";
  height: 30px;
  width: 5px;
  position: absolute;
  left: 0;
  top: 0;
  background: #0c204d;
}

.mixProportion /deep/ .el-form-item__content {
  margin-left: 180px !important;
}
.fillableBox {
  display: flex;
}
.JpList {
  width: 250px;
  height: 100%;
  border: 1px solid #ccc;
  overflow-y: auto;
  box-sizing: border-box;

  div {
    width: 100%;
    height: 39px;
    line-height: 39px;
    border-bottom: 1px solid #ccc;
    text-align: center;
    background: #fff;
    color: #000;
    box-sizing: border-box;
  }

  .JpSieveListBox {
    width: 100%;
    height: 20px;
    line-height: 20px;
    border-bottom: 1px solid #ccc;
    text-align: center;
    background: #fff;
    color: #000;
  }
  .JpSieveListBox2 {
    background: #1559ba;
    color: #fff;
  }
}
.JpList div:first-child {
  height: 36px;
  line-height: 36px;
}
.JpDetails {
  width: calc(100% - 250px);
  height: 100%;
}
.fillableBox /deep/ .el-table .cell {
  padding: 0 !important;
}

.fillableBox /deep/ .el-input__inner {
  border: none;
  height: 31px !important;
  padding: 0 !important;
  text-align: center;
}

.mixproportionForm /deep/ .el-select {
  width: 100% !important;
}

// .OilStoneRate /deep/ .el-select {
//   width: 100% !important;
// }

// .OilStoneRate /deep/ .el-form-item__content {
//   margin-left: 95px !important;
// }

#mixProportionBox /deep/ .el-collapse-item__content {
  padding-bottom: 10px !important;
}

.OilStoneRate /deep/ .el-col-8 {
  height: 30px;
  width: 33.3%;
}

.selectCondition /deep/ .el-select {
  width: 100px !important;
}

.selectCondition /deep/ .el-input__inner {
  width: 100px !important;
  height: 30px !important;
}
.tensionCollapse /deep/.yjxa-collapse-item__wrap {
  overflow: visible !important;
}
</style>
